import Cookies from 'js-cookie'

const TokenKey = 'Lemon-Token';
const RefreshTokenKey = 'Lemon-Refresh-Token';
const AppIdKey = 'Lemon-AppId';
const WxAuthKey = 'Lemon-Auth';
const WxNextPathKey = 'Lemon-Next-Path';

export function getNextPathAndRemove() {
  let v = Cookies.get(WxNextPathKey);
  removeNextPath();
  return v;
}

export function setNextPath(nextPath) {
  return Cookies.set(WxNextPathKey,nextPath);
}

export function removeNextPath() {
  return Cookies.remove(WxNextPathKey);
}

export function getAuthAndRemove() {
  let v = Cookies.get(WxAuthKey);
  removeAuth();
  return v;
}

export function setAuth(auth) {
  return Cookies.set(WxAuthKey,auth);
}

export function removeAuth() {
  return Cookies.remove(WxAuthKey);
}

export function setAppId(appId) {
  return Cookies.set(AppIdKey, appId);
}

export function getAppId() {
  return Cookies.get(AppIdKey);
}

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  removeRefreshToken();
  return Cookies.remove(TokenKey)
}

export function getRefreshToken() {
  return Cookies.get(RefreshTokenKey)
}

export function setRefreshToken(token) {
  return Cookies.set(RefreshTokenKey, token)
}

export function removeRefreshToken() {
  return Cookies.remove(RefreshTokenKey)
}
